using System;
using System.Collections.Generic;
using System.ComponentModel.DataAnnotations;
using System.ComponentModel.DataAnnotations.Schema;
using System.Linq;
using System.Threading.Tasks;

namespace WorkOrder.Models
{

    [Table("资金流水表")]
    public class 资金流水表
    {
        /// <summary>
        /// 流水ID
        /// </summary>
        [Key]
        [Column("流水ID")]
        public string 流水ID { get; set; } =Guid.NewGuid().ToString();

        /// <summary>
        /// 用户ID
        /// </summary>
        [Column("用户ID")]
        [StringLength(50)]
        public string 用户ID { get; set; }

        /// <summary>
        /// 变动金额
        /// </summary>
         [Column("变动金额", TypeName = "decimal(18,2)")]
        public decimal 变动金额 { get; set; }

        /// <summary>
        /// 流水类型
        /// </summary>
        [Column("流水类型")]
        public FlowType 流水类型 { get; set; }

        /// <summary>
        /// 交易状态
        /// </summary>
        [Column("交易状态")]
        public FlowStatus 交易状态 { get; set; } = FlowStatus.PROCESSING;

        /// <summary>
        /// 创建时间
        /// </summary>
        [Column("创建时间")]
        public DateTime 创建时间 { get; set; } = DateTime.Now;


        /// <summary>
        /// 创建时间
        /// </summary>
        [Column("备注")]
        public string? 备注 { get; set; } 


        
        [Column("操作人ID")]
        public string 操作人ID { get; set; }
    

        /// <summary>
        /// 关联业务ID
        /// </summary>
        [Column("关联业务ID")]
        public string? 关联业务ID { get; set; }
        /// <summary>
        /// 用户账户
        /// </summary>
        [ForeignKey("用户ID")]
        public virtual 用户账户余额表 用户账户余额表 { get; set; }

        [ForeignKey("关联业务ID")]
        public virtual  工单主表 工单主表 { get; set; }

     
    } 

 

    /// <summary>
    /// 交易状态枚举
    /// </summary>
    public enum FlowStatus
    {
        PROCESSING, // 处理中
        SUCCESS,    // 成功
        FAILED      // 失败
    }
    }
